home *** CD-ROM | disk | FTP | other *** search
- ; Program author: Jeffrey S. Coy Jr. 11/18/93
- ;
- ;
- ; This program was written to facilitate an error on a friend's computer.
- ;
- ; The computer was incapable of recognizing when a new disk was inserted
- ; into a drive, and caused failure on most multi-disk program
- ; installations.
- ;
- ; The simplest solution was to run DOS's CHKDSK.EXE to force the computer
- ; to recognize the new disk, but this was impossible to do from within
- ; another .exe program (such as install.exe). A second solution was to
- ; run desqview and open a second window during installation to run the
- ; chkdsk.exe program, but this was an inconvinience at best.
- ;
- ; This program patches into the keyboard flag's so that whenever they are
- ; invoked this program will search for RIGHT SHIFT-SCROLL LOCK. If this
- ; combination is triggered, this program will go to 40h:3f7h and set
- ; bit 7 (diskette change bit) on the floppy drive controller.
- ; Nothing is output to screen, as this would be annoying.
- ;
- ; Let it be known that more time was spent on these brief notes than on
- ; the acctual program.
- ;
- ; LEGAL STUFF: all mentioned programs, companies, &c are copyright of
- ; same/said. This program is dedicated to the public domain and free
- ; distribution is highly encouraged. May others follow this same
- ; ideology (please). If you feel you must send me money, you have to
- ; find me first (GRIN).
- ;
- ; PS: I hope this works.
- ;
- ;To assemble: MASM NEWDISK
- ; LINK NEWDISK
- ; EXE2BIN NEWDISK.EXE NEWDISK.COM
- ; DEL NEWDISK.EXE
- ;
- cr equ 10
- lf equ 13
- space equ 32
-
- rightshift equ 00000001b ;at 40h:17h this is flag for right shift depressed
- leftshift equ 00000010b ;at 40h:17h this is flag for left shift depressed
- scrollock equ 00010000b ;at 40h:18h this is flag for scroll lock depressed
- diskchange equ 10000000b ;at 40h:3f7h this is flag for disk change
-
- DUMMY SEGMENT STACK ;Avoid linking error
- DUMMY ENDS ;All segments must end
- CODE SEGMENT
- ASSUME CS:CODE, DS:CODE, ES:CODE, SS:CODE ;COM type program
- ORG 100H ;starts at 100h
- ;all segments common
-
- START: JMP SETUP
-
- ;This is our interrupt service routine. It will be executed each time
- ;the bios keyboard interrupt is triggered.
-
- DB 3
- TRAP:
- sti
- pushf
- PUSH AX ;save a bunch of registers
- PUSH BX
- PUSH CX
- PUSH DX
- PUSH DS
- PUSH ES
- PUSH BP
- push si
- push di
- PUSH CS
- POP DS ;get CS to DS
- checkright:
- MOV BX,40H ;get BIOS data segment }
- MOV ES,BX ;to ES } / This is much more compact \
- MOV BX,17H ;use BX to form full pointer }-< and thus much faster than >
- MOV AL,BYTE PTR ES:[BX] ;look at keyboard flags } \ INT 16H function 2. /
- and al,rightshift ;is rightshift depressed?
- jnz chkscroll ;if so go check the scroll lock
- jmp SKIP ;else SKIP out
- chkscroll:
- MOV BX,40H ;get BIOS data segment }
- MOV ES,BX ;to ES } / This is much more compact \
- MOV BX,18H ;use BX to form full pointer }-< and thus much faster than >
- MOV AL,BYTE PTR ES:[BX] ;look at keyboard flags } \ INT 16H function 2. /
- and al,scrollock ;is scroll lock depressed?
- jnz settheflag ;if so, go set the flag
- jmp SKIP ;else SKIP out
- settheflag:
- mov bx,40h ;get bios data segment to es
- mov es,bx
- mov bx,3f7h ;configuration control register
- mov al,byte ptr ES:[BX] ;get current status of controller
- or al,diskchange ;set disk change bit
- mov byte ptr ES:[BX],al ;and put flags back
- SKIP:
- pop di ;restore all registers
- pop si
- POP BP
- POP ES
- POP DS
- POP DX
- POP CX
- POP BX
- POP AX
- popf
- JMP DWORD PTR CS:VECSAV ;chain to original vector owner
- VECSAV: DD 0
- db 0
-
- END_RES LABEL NEAR ;Mark end of resident code
-
- ;First we set up our interrupt vector so we can use it
-
- SETUP:
- PUSH CS
- POP DS
- MOV AX,3509H ;keyboard hardware interrupt
- INT 21H
- MOV WORD PTR VECSAV,BX
- MOV WORD PTR VECSAV[2],ES
- MOV AL,BYTE PTR ES:[BX[-1]] ;See what vector points to
- CMP AL,03H ;skel.COM already loaded?
- JZ ABORT ;if so, exit.
- PUSH CS
- POP DS
- MOV AX,2509H
- MOV DX,OFFSET TRAP
- INT 21H
- MOV AH,09
- MOV DX,OFFSET SIGNON
- INT 21H
- MOV DX,OFFSET END_RES ;Mark end of resident code
- INT 27H ;Terminate and stay resident
- ABORT: MOV DX,OFFSET SIGNOF
- MOV AH,09
- INT 21H
- INT 20H
-
- SIGNON: DB CR,LF,'NEWDISK.COM LOADED',CR,LF,CR,LF,'$'
- SIGNOF: DB CR,LF,'NEWDISK.COM already loaded',CR,LF,CR,LF,'$'
-
-
- CODE ENDS ;Mark end of our Code segment
- END START ;Tell Assembler where to begin execution
-